package day01;

import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import untils.ClickEvent;
import untils.ClickSource;

public class Example3 {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);

        env
                    .addSource(new ClickSource())
                    .map(new MapFunction<ClickEvent, String>() {
                        @Override
                        public String map(ClickEvent value) throws Exception {
                            return value.username;
                        }
                    })
                    .print();
        env
                    .addSource(new ClickSource())
                    .map(r -> r.ts)
                    .print();

        env.execute();
    }
}
